package tds.model1.version2;
/**
 * 
 * @Company 杭州先锋电子技术股份有限公司
 * @ClassName Calculation
 * @Description TODO(计算类)
 * @author tds
 * @Date 2019年1月3日 下午1:51:17
 * @version 1.0.0
 */
public class Calculation {
	public static double calculate(double param1, double param2, String operator){
		Operate operate = Operate.valueOperationOf(operator);
		if(operate == null){
			throw new RuntimeException("操作符不存在");
		}
		Calculate calculate = CalculateFactory.getCalculate(operator);
		calculate.setParam1(param1);
		calculate.setParam2(param2);
		return calculate.calulate();
	}
}
